package com.one.square.user.server.controller;

import com.one.square.core.domain.Result;
import com.one.square.core.entity.SysMenu;
import com.one.square.user.interfaces.service.service.SysMenuInterface;
import com.one.square.user.server.service.SysMenuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author cwm
 * @Description 用户菜单接口
 * @date 2021/10/21 上午11:38
 * @Version 1.0
 */
@RestController
@RequestMapping("/sys/menu")
@AllArgsConstructor
@Api(value = "/sys/menu", tags = {"用户菜单接口"})
public class SysMenuController implements SysMenuInterface {

    private final SysMenuService service;

    @GetMapping("/menus/roleCodes")
    @ApiOperation(value = "根据角色code查询权限菜单")
    @Override
    public Result<List<SysMenu>> findByRoleCodes(@RequestParam("roleCodes")List<String> roleCodes) {
        return Result.succeed(service.findByRoleCodes(roleCodes));
    }
}
